Skip to content

WOOP-1151: Add workload_custom_metrics_data_source TF resource#669

Merged
damiankaminski merged 10 commits intomasterfrom
dk/WOOP-1151/custom-metrics-data-source
Mar 30, 2026
Merged

WOOP-1151: Add workload_custom_metrics_data_source TF resource#669
damiankaminski merged 10 commits intomasterfrom
dk/WOOP-1151/custom-metrics-data-source

Conversation

@damiankaminski
Copy link
Copy Markdown
Contributor

  • Supports Prometheus data source type with presets (e.g. "jvm") and manual metric definitions
  • Full CRUD operations using the WorkloadOptimizationAPI custom metrics endpoints
  • Import support with format <cluster_id>/<data_source_id>
  • Read uses List endpoint and filters by ID (no individual GET endpoint exists)
  • Unit tests covering create (presets + manual metrics), read not-found, update, delete, and import

@damiankaminski damiankaminski requested a review from a team as a code owner March 23, 2026 14:07
@damiankaminski damiankaminski force-pushed the dk/WOOP-1151/custom-metrics-data-source branch from b1b0218 to e611060 Compare March 25, 2026 10:00
@damiankaminski damiankaminski marked this pull request as draft March 25, 2026 10:02
- Supports Prometheus data source type with presets (e.g. "jvm") and manual metric definitions
- Full CRUD operations using the WorkloadOptimizationAPI custom metrics endpoints
- Import support with format <cluster_id>/<data_source_id>
- Read uses List endpoint and filters by ID (no individual GET endpoint exists)
@damiankaminski damiankaminski force-pushed the dk/WOOP-1151/custom-metrics-data-source branch from 478d4b7 to e61bc26 Compare March 25, 2026 14:54
@damiankaminski damiankaminski marked this pull request as ready for review March 25, 2026 14:58
Read manual metrics from the new `resolved` API field by filtering queries with MANUAL origin, instead of matching `resolved_metrics` against Terraform state. This fixes `terraform import` which previously lost all manual metrics because there was no prior state to compare against. Also updates the input field from `Custom` to `Manual` to match the renamed API field, and removes the now-unnecessary `getConfiguredManualMetrics` helper.
Aligns the Terraform schema with the CREATE/UPDATE API and CRD by using a single `query` field per metric block instead of a `queries` list. Multiple queries for the same metric are expressed as multiple metric entries with the same name.
… diffs

The metric block used TypeList which is order-sensitive, causing Terraform to show false diffs when the API returned metrics in a different order than the config. Switching to TypeSet makes comparison order-agnostic by hashing on name+query content.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants